const BASE_URL = "http://www.pudge.wang:4000"

const request = (url, method = "GET", data = {}) => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: BASE_URL + url,
            method,
            data,
            header: {
                'content-type': 'application/json'
            },
            success: (res) => {
                resolve(res.data)
            }
        })
    })
}

module.exports = request;